﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace SplitViewOptions
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class Lixianread : Page
    {
        public Lixianread()
        {
            this.InitializeComponent();
            try
            {
                using (var db = new BloggingContext())
                {


                    List<Post> BlogsItemsSource = db.Posts.ToList();
                    navigateviewer.ItemsSource = BlogsItemsSource;
                }
            }
            catch(Exception ex)
            {

            }           
        }

        private void Border_Tapped(object sender, TappedRoutedEventArgs e)
        {
            viewgrid.Visibility = Visibility.Visible;
            web.NavigateToString(((sender as Border).DataContext as Post).Content);
            navigateviewer.Visibility = Visibility.Collapsed;
        }

        private void viewgrid_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
        {
            //viewgrid.Visibility = Visibility.Collapsed;
            ////web.NavigateToString(((sender as Border).DataContext as Post).Content);
            //navigateviewer.Visibility = Visibility.Visible;
        }

        private void viewgrid_PointerEntered(object sender, PointerRoutedEventArgs e)
        {
           
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            viewgrid.Visibility = Visibility.Collapsed;
            //web.NavigateToString(((sender as Border).DataContext as Post).Content);
            navigateviewer.Visibility = Visibility.Visible;
        }
    }
}
